﻿

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Dynamic;
using System.Text;
using System.Threading.Tasks;
using Abp;
using Abp.Application.Services.Dto;
using Abp.Authorization;
using Abp.AutoMapper;
using Abp.Configuration;
using Abp.Domain.Repositories;
using Abp.Extensions;
using Abp.Linq.Extensions;
using System.Linq.Dynamic.Core;
using KDS.Mes.Dto;
using KDS.Mes.Authorization;
using KDS.Mes.Mes.Reports_Report.Dtos;
using KDS.Mes.Mes.Retrospects.Dtos;
using KDS.Mes.Mes.Reports_Offline.Dtos;

namespace KDS.Mes.Mes.Reports_Report
{
    /// <summary>
    /// 用于JIT生产的序列信息表服务实现
    /// </summary>
    [AbpAuthorize(AppPermissions.Pages_Report_Retrospects)]


    public class Reports_ReportAppService : MesAppServiceBase, IReports_ReportAppService
    {
        //private readonly IRepository<SeqJit, int> _seqJitRepository;
        //private readonly ISeqJitListExcelExporter _seqJitListExcelExporter;


        //private readonly SeqJitManage _seqJitManage;
        private readonly ISqlExecuter _sqlExecuter;

        /// <summary>
        /// 构造方法
        /// </summary>
        public Reports_ReportAppService(ISqlExecuter sqlExecuter)
        {
            _sqlExecuter = sqlExecuter;
        }
        //public ListResultDto<RetrospectListDto> GetRetrospect(GetRetrospectInput input)
        //{
        //    string sql = "exec sp_Report_Get_Retrospect '" + input.SeatID + "'";
        //    var charts = _sqlExecuter.SqlQuery<RetrospectListDto>(sql).ToList();

        //    return new ListResultDto<RetrospectListDto>(charts.MapTo<List<RetrospectListDto>>());
        //    //return charts;
        //}

        public List<Reports_ReportListDto> GetReports_Report(GetReports_ReportInput input)
        {
            string sql = "EXEC	[dbo].[sp_Report_Get_P_Produce] @begintime = N'"+input.Time1+"', @endtime = N'"+input.Time2+"'";
            var charts = _sqlExecuter.SqlQuery<Reports_ReportListDto>(sql).ToList();

            return new List<Reports_ReportListDto>(charts.MapTo<List<Reports_ReportListDto>>());
            //return charts;
            //string sql = "exec sp_Report_Get_Retrospect 'CM11B1710270600'";
            //var charts = _sqlExecuter.SqlQuery<RetrospectListDto>(sql).ToList();

            //return new List<Reports_ReportListDto>(charts.MapTo<List<Reports_ReportListDto>>());
        }
     

        //public RetrospectListDto GetRetrospect(GetRetrospectInput input)
        //{
        //    string sql = "exec sp_Report_Get_Retrospect '" + input.SeatID + "'";
        //    var charts = _sqlExecuter.SqlQuery<RetrospectListDto>(sql);

        //    return charts.MapTo<RetrospectListDto>();
        //    //return charts;
        //}







    }
}
